//导入vue-router
import { createRouter, createWebHistory } from 'vue-router'
//导入组件
//导入登录页
import login from '@/views/login.vue';
//导入基本资料页面
import Jibenziliao from '@/views/jibenziliao.vue';
import mercxq from "@/views/merchant/merchant.vue";
import ordere from "@/views/merchant/ordere.vue";
import gerenxq from "@/views/merchant/gerenxq.vue";
import commodity from "@/views/merchant/commodity.vue";
import mima from "@/views/merchant/mima.vue";
import shimirz from "@/views/merchant/shimirz.vue";
const Merchant = () => import('@/views/admin/admimerchant.vue');
const Driver = () => import('@/views/admin/admindriver.vue');
const Denglu = () => import('@/views/admin/Adminlogin.vue');
const Ordere = () => import('@/views/admin/ordere.vue');


//设置路由关系
const luyou = [
    //path:决定了怎么去页面
    //component: 去哪个页面
    //children：[孙路由]
    {
        path:'/',
        component:login
    },{
        path:'/yemian',
        component:Jibenziliao
    },
    {
        path: "/mercxq",
        component: mercxq,
        children: [
          { path: "/ordere", component: ordere },
          { path: "/gerenxq", component: gerenxq,},
          {path: "/commodity", component: commodity,},
          {path: "/mima", component: mima,},
          {path: "/shimi", component: shimirz,}
        ],
      
    },
    //管理员登录
    {
        path: '/admin',
        component: Denglu,
    },
    //管理员页面
    {
        path: '/merchant',
        component: Merchant,
        children: [
            {
                path: 'driver', 
                component: Driver
            },
            {
                path: 'ordere', 
                component: Ordere
            }
        ]
    }
]
//创建路由对象
const luduixiang=createRouter({
    routes:luyou,//将我们自己定义的路由添加到对象中
    history:createWebHistory()


});
export default luduixiang;

